#include <iostream>
#include <fstream>

#include "polyline_simplification.h"

double eps;
bool* res;
Point* point_list;
int n;

int main() 
{
   std::cin >> n;
   point_list = new Point[n];

   for (int i = 0; i < n; i++) 
   {
      Point t;
      std::cin >> t;
      point_list[i] = t;
   }
   std::cin >> eps;

   res = new bool[n];
   std::cout << DP(point_list, res, n, eps) << "\n";

   for (int i = 0; i < n; i++) 
   {
      if (res[i] == true) {
         std::cout << i + 1 << " ";
      }
   }
   delete[] point_list;
   delete[] res;

   return 0;
}